import 'package:bitcoin_mine/services/in_app_purchase_service.dart';
import 'package:bitcoin_mine/widgets/animated_subscribe_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../controllers/subscription_controller.dart';
import '../l10n/app_localizations.dart';

class SubscriptionBottomBar extends StatelessWidget {
  const SubscriptionBottomBar({super.key});

  @override
  Widget build(BuildContext context) {
    final SubscriptionController controller = Get.find();
    final InAppPurchaseService inAppPurchaseService =
        Get.find<InAppPurchaseService>();
    final l10n = AppLocalizations.of(context);

    return Container(
      height: 90.h,
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage('assets/images/pic_select_price_bg.png'),
          fit: BoxFit.fill,
        ),
      ),
      child: Obx(() {
        return Row(
          children: [
            // 左侧价格信息
            Expanded(
              flex: 2,
              child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 16.w),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      controller.currentSelectedPrice,
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 26.sp,
                        fontWeight: FontWeight.w400,
                      ),
                    ),

                    Text(
                      l10n.membershipBeginnerMining,
                      style: TextStyle(color: Colors.white, fontSize: 16.sp),
                    ),
                    Text(
                      controller.currentSelectedNextPrice,
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 12.sp,
                        fontWeight: FontWeight.normal,
                      ),
                    ),
                  ],
                ),
              ),
            ),

            // 右侧订阅按钮
            Expanded(
              child: AnimatedSubscribeButton(
                onTap: controller.subscribe,
                text: l10n.membershipSubscribe,
                textStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(
                  color: const Color(0xFF061125),
                  fontSize: 16.sp,
                  fontWeight: FontWeight.w600,
                ),
              ),
            ),
            SizedBox(width: 10.w),
          ],
        );
      }),
    );
  }
}
